@extends('admin.common.base-master')

@section('html-head')
    <link href="{{url('css/admin/pagenum.css')}}" rel="stylesheet" />

@endsection

@section('html-body')
    <div id="content">
        <!-- cur-position start -->
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            <a href="">职位管理</a>
        </div>

        <div class="filter-box clearfix">

        </div>
        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>用户手机</th>
                    <th>行业</th>
                    <th>任职类型</th>
                    <th>职位</th>
                    <th>招聘人数</th>
                    <th>薪资类型</th>
                    <th>薪资金额</th>
                    <th>收到的简历</th>
                    <th>是否置顶</th>
                    <th>置顶时长</th>
                    <th>排序</th>
                    <th>职位状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @if(count($positions) > 0)
                    @foreach($positions as $position)
                        <tr id="banner_{{$position->id}}">
                            <td>{{$position->id}}</td>
                            <td>{{$position->phone}}</td>
                            <td>{{$position->trade}}</td>
                            <td>
                                @if($position->type == 0)
                                    全职
                                @elseif($position->type ==1)
                                    兼职
                                @elseif($position->type ==2)
                                    实习
                                @endif
                            </td>
                            <td>{{$position->job_type}}</td>
                            <td>{{$position->people_num}}</td>
                            <td>{{$position->salary_type}}</td>
                            <td>{{$position->salary_num}}</td>
                            <td><a href="{{route('Admin.Home.positionResumeList')}}?position_id={{$position->id}}">查看简历</a></td>
                            <td>
                                @if($position->set_top == 0)
                                    未置顶
                                @else
                                    已置顶
                                @endif
                            </td>
                            <td>{{$position->set_top_time}}</td>
                            <td>{{$position->sort}}</td>
                            <td>
                                @if($position-> state == 0)
                                    等待招聘
                                @else
                                    招聘中
                                @endif
                            </td>

                            <td>{{$position->created_at}}</td>
                            <td><a href="{{route('Admin.Home.positionListDetail')}}?id={{$position->id}}" target="_blank">查看详情</a><span> | </span>
                                {{--<a href="">编辑</a> <span> | </span>--}}
                                <a href="javascript:void(0);" class="del" data-id="{{$position->id}}" style="color: red;" e>删除 </a></td>
                        </tr>
                    @endforeach
                @endif
                </tbody>
            </table>
        </div>
        <div class="pagelist" style="text-align: center;">
            <?php echo $positions->render(); ?>
        </div>
    </div>
    <script>
        $(function(){

            $(document).on("click",".del",function(){
                var id = $(this).attr("data-id");
                $.ajax({
                    url:'{{route("Api.Admin.sys.delPosition")}}',
                    type:'post',
                    dataType:'json',
                    data:{id:id},
                    success:function(obj){
                        if(obj.level == "success"){
                            $("#banner_"+id).hide('slow');
                        }else{
                            noty({type:obj.level,text:obj.message,timeout:600});
                        }
                    },
                    error:function(obj){
                        console.log(obj);
                    }

                });
            });
        });
    </script>
@endsection